<template>
	<view class="page">
		<!-- @tap="to(item.push_id)" -->
		<view class="cell flex" v-for="(item,index) in list"  >
			<view class="cell-head">
				<image :src="item.avatar" class="avatar"></image>
			</view>
			<view class="flex-1">
				<view class="cell-text"> 
					{{item.nickname}}&emsp;{{item.status|statustext}}了你 <text v-if="item.status!=3">的&emsp;{{item.type|typename}}</text> 
				</view>
				<view class="cell-text text-gray u-line-2">{{item.content}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {NewsgetList} from "@/common/config/chat.js"
	export default {
		data() {
			return {
				page:0,
				total:0,
				list:[]
			}
		},
		filters:{
			statustext(e){
				var text
				// console.log(e)
				switch(e){
					case 0:
					return text='点赞'
					case 1:
					return text='评论'
					case 2:
					return text='回复'
					case 3:
					return text='关注'
				}
			},
			typename(e){
				var typetext
				switch(e){
					case 0:
					return typetext='短讯'
					case 1:
					return typetext='文章'
					case 2:
					return typetext='视频'
				}
			}
		},
		onShow() {
			this.list=[]
			this.getList()
			console.log('dddddddddddddddddddddddddddddddddddddddddddddddd')
		},
		onReachBottom() {
			if(this.list.length<this.total){
				this.getList()
			}
		},
		methods:{
			getList(){
				NewsgetList({
					page:this.page
				}).then(res=>{
					console.log(res,'消息通知')
					this.list=[...this.list,...res.data.data.data]
					this.total=res.data.data.total
					if(this.list.length<this.total){
						this.page++
					}else{
						uni.showToast({
							icon:'none',
							title:'没有更多数据了'
						})
					}
				})
			},
			to(item){
				uni.navigateTo({
					url:`/pages/other/other?type=reply&title=${item.title}&detail=${item.detail}`
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	

.flex{
	display: flex;
	&-1{
		flex: 1;
	}
	&-between{
		justify-content: space-between;
	}
}
.cell{
	padding: 20rpx 30rpx;
	align-items: center;
	border-bottom: 1px solid #eaeaea;
	&:last-child{
		border: none;
	}
	.cell-head{
		margin-right: 20rpx;
		position: relative;
	}
	.avatar{
		width: 100rpx;
		height: 100rpx;
		border-radius: 84px;
	}
	.cell-text{
		padding: 4rpx 0;
	}
}


</style>
